package com.zy.teacherSide.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.teacherSide.entity.StudentTaskAchievement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 29787
 */
@Mapper
@Component
public interface StudentTaskAchievementDao extends BaseMapper<StudentTaskAchievement> {

    /**
     * 根据课程id，教师id，班级id,作业id,学生id查询当作业
     * @param courseId
     * @param taskId
     * @param teacherId
     * @param studentId
     * @param classroomId
     * @return List<StudentTaskAchievement>
     */
    @Select("select * from hms_student_task_achievement where task_id=#{taskId} and course_id=#{courseId}  and student_id=#{studentId} and teacher_id=#{teacherId} and classroom_id=#{classroomId}")
    List<StudentTaskAchievement> getStudentTaskAchievement(Integer courseId, Integer taskId, Integer teacherId, Integer classroomId, Integer studentId);

    /**
     * 根据课程id，教师id，班级id,作业id查询当作业
     * @param courseId
     * @param taskId
     * @param teacherId
     * @param classroomId
     * @return StudentTaskAchievement
     */
    @Select("select * from hms_student_task_achievement where task_id=#{taskId} and course_id=#{courseId}  and student_id=#{studentId} and teacher_id=#{teacherId} and classroom_id=#{classroomId}")
    StudentTaskAchievement getStudentTaskAchievements(Integer courseId, Integer taskId, Integer teacherId, Integer classroomId, Integer studentId);

    /**
     * 根据课程id，教师id，班级id,作业id查询当作业
     * @param courseId
     * @param taskId
     * @param teacherId
     * @param classroomId
     * @return List<StudentTaskAchievement>
     */
    @Select("select * from hms_student_task_achievement where task_id=#{taskId} and course_id=#{courseId} and teacher_id=#{teacherId} and classroom_id=#{classroomId}")
    List<StudentTaskAchievement> getStudentTaskAchievementByCourseIdAndTaskIdAndClassroomIdAndTeacherId(Integer courseId, Integer taskId, Integer teacherId, Integer classroomId);

}
